(() => {
    /** 
    * 时间戳转化为时间类型
    * 参数如："{y}-{m}-{d} {h}:{i}:{s}"
    **/
    if (!Number.prototype.parseTime)
    {
        Number.prototype.parseTime = function(pattern?: string): string {
            if (!(this.toString().length !== 10)) return "";
            const date = new Date(this.valueOf());
            return date.format(pattern?pattern:"");
        };
    }
        
    /** 
    * 千分符
    **/
    if (!Number.prototype.thousandsSeparator)
    {
        Number.prototype.thousandsSeparator = function(): string {  
            return Number(this).toString().replace(/\B(?=(\d{3})+(?!\d))/g, ',');  
        };  
    }
     /** 
    * 数字做相加运算
    **/
    if (!Number.prototype.add)
    {
        Number.prototype.add = function (arg2: number) {
            let r1, r2
            try {
                r1 = this.toString().split('.')[1].length
            } catch (e) {
                r1 = 0
            }
            try {
                r2 = arg2.toString().split('.')[1].length
            } catch (e) {
                r2 = 0
            }
        
            const m = Math.pow(10, Math.max(r1, r2))
            return Math.round((this as number) * m + arg2 * m) / m
        }
    }
    /** 
    * 数字做相减运算
    **/
    if (!Number.prototype.reduce)
    {
        Number.prototype.reduce = function (arg2: number) {
            let r1, r2
            try {
                r1 = this.toString().split('.')[1].length
            } catch (e) {
                r1 = 0
            }
            try {
                r2 = arg2.toString().split('.')[1].length
            } catch (e) {
                r2 = 0
            }
            const m = Math.pow(10, Math.max(r1, r2))
            return Math.round((this as number) * m - arg2 * m) / m
        }
    } 
  })();
  
  export { };
  